<?php

namespace App\Http\Requests\Permission;

use App\Http\Requests\Admin\ApiRequest;

class PermissionToUserRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * 'to/user'：前端路由
     *
     * @return bool
     */
    public function authorize()
    {
        return self::checkPermission('to/user');
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'user_id' => 'required|integer',
            'permission_ids' => 'array'
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'user_id.required'=>'请传入用户ID。',
            'user.integer'=>'用户ID参数类型错误。'
        ];
    }
}
